package org.tacademy.and12th.jungyonghyun;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

class Stringtoint extends Activity {
	public void math () {
		
	EditText editText1;
	EditText editText2;
	editText1 = (EditText)findViewById(R.id.editText1);
	editText2 = (EditText)findViewById(R.id.editText2);
	int a = Integer.parseInt(editText1.getText().toString());
	int b = Integer.parseInt(editText2.getText().toString());	
	}
}

public class MainActivity extends Activity {

	EditText editText1;
	EditText editText2;
	TextView textView;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.test_layout);
		
		editText1 = (EditText)findViewById(R.id.editText1);
		editText2 = (EditText)findViewById(R.id.editText2);
		textView = (TextView)findViewById(R.id.textView1);
		Button btn = (Button)findViewById(R.id.button1);
		
		
		btn.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
			// TODO Auto-generated method s
				int a = Integer.parseInt(editText1.getText().toString()) + Integer.parseInt(editText2.getText().toString());	
				textView.setText(""+a+"");
			}
		});
		Button btn1 = (Button)findViewById(R.id.button2);
		btn1.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
			// TODO Auto-generated method s
				int a = Integer.parseInt(editText1.getText().toString()) - Integer.parseInt(editText2.getText().toString());			
				textView.setText(""+a+"");
			}
		});
		Button btn2 = (Button)findViewById(R.id.button3);
		btn2.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
			// TODO Auto-generated method s
				int a = Integer.parseInt(editText1.getText().toString()) * Integer.parseInt(editText2.getText().toString());			
				textView.setText(""+a+"");
			}
		});
		Button btn3 = (Button)findViewById(R.id.button4);
		btn3.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
			// TODO Auto-generated method s
				int a = Integer.parseInt(editText1.getText().toString()) / Integer.parseInt(editText2.getText().toString());	
				textView.setText(""+a+"");
			}
		});
	}
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
